cmake_minimum_required(VERSION 3.10)

project(ScreenSplitAssist VERSION 1.0.0)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找 Qt5 模块，添加 Network 模块
find_package(Qt5 COMPONENTS Widgets Network REQUIRED)

set(SOURCES
    main.cpp
    mainwindow.cpp
    moc_mainwindow.cpp
)

set(HEADERS
    mainwindow.h
)

set(FORMS
    mainwindow.ui
)

qt5_wrap_ui(UI_HEADERS ${FORMS})

add_executable(ScreenSplitAssist ${SOURCES} ${HEADERS} ${UI_HEADERS})

# 链接 Qt5 模块，添加 Network 模块
target_link_libraries(ScreenSplitAssist PRIVATE Qt5::Widgets Qt5::Network)

# 手动添加 Qt 头文件包含路径
include_directories(${Qt5Network_INCLUDE_DIRS})

# 开启自动 MOC 生成
set(CMAKE_AUTOMOC ON)

# 强制重新生成 MOC 文件
set(CMAKE_AUTOMOC_MOC_OPTIONS "-M")